<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>奶茶收银</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no" />
	<link rel="stylesheet" href="css/bootstrap/css/bootstrap.css">	
	<link rel="stylesheet" href="css/bootstrap/css/bootstrap.min.css">	
	<link rel="stylesheet" href="css/bootstrap/css/bootstrap.min.css">	
	<link rel="stylesheet" href="css/common.css">
	<link rel="stylesheet" href="css/index.css">
	<link rel="stylesheet" href="css/datatable.min.css">
	<link rel="stylesheet" href="css/font-awesome-4.7.0/css/font-awesome.css">
	<link rel="stylesheet" href="css/font-awesome-4.7.0/css/font-awesome.min.css">

	<!-- <script src="js/datatable.js"></script> -->
	<!-- <script src="js/jquery.jeditable.js"></script> -->
	
	<script src="js/jquery-3.1.0.min.js"></script>
	<script src="js/jquery.dataTables.min.js"></script>
	<script src="js/datatables.bootstrap.js"></script>
	<script src="js/bootstrap.min.js"></script>
	<script src="js/index.js"></script>
	<script src="js/datatable.js"></script>
	<script src="js/jquery.easing.js"></script>
	<style>
		
	</style>
</head>
<body style="transition:all 2s">
	<div class="bg-mask-div">
	</div>
	<div class="skinBox">
		<div class="skinList">
			<div class="colorPrintor">
				<ul>
					<li><span></span><i class="fa fa-check" aria-hidden="true"></i></li>
					<li><span></span><i class="fa fa-check" aria-hidden="true"></i></li>
					<li><span></span><i class="fa fa-check" aria-hidden="true"></i></li>
				</ul>
			</div>
			<div class="skinListDiv"><i class="fa fa-check" aria-hidden="true"></i></div>
			<div class="skinListDiv"><i class="fa fa-check" aria-hidden="true"></i></div>
			<div class="skinListDiv"><i class="fa fa-check" aria-hidden="true"></i></div>
		</div>
		<div class="skinBox-after">
			<i class="fa fa-angle-down" aria-hidden="true"></i>
		</div>
	</div>
	<div id="wrapper" >
		<div id="sidebar-left" class="fl">
			<div id="header" class="skin">
				<div class="head-menu">
					<i title="我的信息" class="fa fa-user-circle-o" aria-hidden="true"></i>
					<span>值班员：<span class="onDuty">${sessionScope.name}</span></span>
				</div>
				<div class="head-menu">
					<!-- <i class="fa fa-database" title="后台管理" aria-hidden="true"></i> -->
					<a href="back.jsp"><i href="back.html" title="后台管理" class="fa fa-database" aria-hidden="true"></i></a>
					<i onclick="header.exitUser()" title="退出" class="fa fa-sign-out" aria-hidden="true"></i>
				</div>
				
			</div>
			<div class="inner">
				<!--<div class="staff-widget-detail">
					<div class="staff-detail-up">
						<span>值班员</span>
						<span>工号</span>
					</div>
					<div class="staff-detail-down">
						
					</div>
				</div>-->
				<div class="product-list">
					<ul>
						<!--<li>
							<div class="product-top-description">
								<h4>进口柠檬茶</h4><span class="product-middle-spec">茶，大杯，常温，低糖</span>
							</div>
							<div class="product-down-price">
								<div class="product-num-choose">
									<span class="minus" >－</span>
									<span class="product-num-span" ><input class="product-num" value="1" tyep="text"/></span>
									<span class="add">＋</span>
								</div>
								<div class="product-num-price">
									<span><i>¥</i>15</span>
								</div>
							</div>
							<div class="product-right-delete">
								<i class="fa fa-trash-o" aria-hidden="true"></i>
							</div>
						</li>-->
						<!--<li>
							<div class="product-left-img">
								<img src="img/2.jpg" alt="柠檬茶">
							</div>
							<div class="product-top-description">
								<span>进口柠檬茶</span>
							</div>
							<div class="product-middle-spec">
								<span>222</span>
								<span>多奶少糖</span>
							</div>
							<div class="product-down-price">
								<div class="product-num-choose">
									<span class="minus" >－</span>
									<span class="product-num-span" ><input class="product-num" value="1" tyep="text"/></span>
									<span class="add">＋</span>
								</div>
								<div class="product-num-price">
									<span><i>¥</i>300</span>
								</div>
							</div>
							<div class="product-right-delete">
								<i class="fa fa-trash-o" aria-hidden="true"></i>
							</div>
						</li>
						<li>
							<div class="product-left-img">
								<img src="img/2.jpg" alt="柠檬茶">
							</div>
							<div class="product-top-description">
								<span>进口柠檬茶</span>
							</div>
							<div class="product-middle-spec">
								<span>222</span>
								<span>多奶少糖</span>
							</div>
							<div class="product-down-price">
								<div class="product-num-choose">
									<span>－</span>
									<span class="product-num-span" ><input class="product-num" value="1" tyep="text"/></span>
									<span>＋</span>
								</div>
								<div class="product-num-price">
									<span><i>¥</i>300</span>
								</div>
							</div>
							<div class="product-right-delete">
								<i class="fa fa-trash-o" aria-hidden="true"></i>
							</div>
						</li>-->
					</ul>
				</div>
				<div class="order-total-foot">
					<ul>
						<li>件数<span>0</span></li>
						<li>原价<span>0</span></li>
						<li>队列<span id="queenNo">1</span></li>
						<!-- <li>折扣<span>90%</span></li> -->
						<!--<li>积分<span>123</span></li>-->
						<!--<li>优惠券<span>无</span></li>-->
						<li>合计<span>0</span></li>
					</ul>
				</div>
				<!-- <div class="order-total-btn">
					<button class="btn btn-lg btn-primary product-discount">优惠</button>
					<button onclick="createSale()" class="btn btn-lg product-checkout skin">下单&nbsp&nbsp<span>00.00</span></button>
				</div> -->
			</div>
		</div
		><div id="sidebar-right" class="fl">
			<div class="inner">
				<div class="product-type-before">
					<div class="produxtTypeBefore">
						<!-- <span><</span> -->
						<span><!-- <i class="fa fa-angle-left" aria-hidden="true"></i> --></span>
					</div>
					<div class="produxtTypeAfter">
						<!-- <span><</span> -->
						<span><!-- <i class="fa fa-angle-right" aria-hidden="true"></i> --></span>
					</div>
				</div>
				<div class="product-type-list">
					<ul class="skin list-tmp-ul">
						<li><span class='pressDown'>全部商品</span></li>
						<!-- <li><a class='pressDown'  href="javascript:void(0)"><</a></li>
						<li><a class='pressDown'  href="javascript:void(0)">全部商品</a></li>
						<li><a href="javascript:void(0)">汽水</a></li>
						<li><a href="javascript:void(0)">茶</a></li>
						<li><a href="javascript:void(0)">奶茶</a></li>
						<li><a href="javascript:void(0)">拿铁咖啡</a></li>
						<li><a href="javascript:void(0)">果汁</a></li> -->
						<!-- <li><a href="javascript:void(0)">奶茶</a></li>
						<li><a href="javascript:void(0)">拿铁咖啡</a></li> -->
						<!-- <li><a href="javascript:void(0)">></a></li> -->
						<!-- <li><a href="javascript:void(0)">果汁</a></li>
						<li><a href="javascript:void(0)">奶茶</a></li> -->
						<!-- <li><a href="javascript:void(0)">拿铁咖啡</a></li> -->
						<!--<li><a href="javascript:void(0)">下一页</a></li>-->
					</ul>
				</div>
				<!-- <div class="product-tree">
					<h5>所有商品</h5>
					<ul class="view-control">
						<li><i class="fa fa-list-ul" aria-hidden="true"></i>图表视图</li>
						<li class="press"><i class="fa fa-th-large" aria-hidden="true"></i>图标视图</li>
						<i class="fa fa-list-ul" aria-hidden="true"></i>
						<i class="fa fa-th-large" aria-hidden="true"></i>
					</ul>
				</div> -->
				<div class="product-list-wrapper">
					<div class="product-table-list controlled">
						<table id="productTable" class="table">
							<thead>
								<tr>
									<th>商品名称</th>
									<th>商品编码</th>
									<th>商品类型</th>
									<th>规格</th>
									<th>描述</th>
									<th>操作</th>
								</tr>
							</thead>
							<tbody>
								
							</tbody>
						</table>
					</div>
					<div class="product-block-list controlled">
						<!-- <div class="product-img-list">
							<div class="product-detail">
								<ul class="product-name">
									<li><span>一粒柠檬茶</span></li>
									<li>
										<span>果茶</span>
									</li>
									<li>
										<i class="fa fa-jpy" aria-hidden="true"></i>
										<span>18</span>
									</li>
									
								</ul>
							</div>
						</div> -->
						<div class="product-list-control">
							<ul class="skin">
								
							</ul>
						</div>
					</div>
				</div>
				<!--<div class="product-">
					
				</div>-->
			</div>
		</div>
		<div class="footer">
			<!-- <div class="order-head-operation">
				<ul>
					<li data-toggle="modal" title="查看订单" onclick="getAllOrder()" data-target="#orderModel"><span>订单</span></li>
					<li onclick="productModule.clearProduct(this)"><span>清空</span></li>
				</ul>
			</div> -->
			<ul class="footer-btn">
				<li onclick="productModule.clearProduct(this)" ><span><i class="fa fa-times-circle-o" aria-hidden="true"></i><br/>清空</span></li>
				<li data-toggle="modal" title="查看订单" onclick="getAllOrder()" data-target="#orderModel" ><span><i class="fa fa-star" aria-hidden="true"></i><br></>订单</span></li>
				<li><div><i class="fa fa-jpy" aria-hidden="true"></i><i>00.00</i></div></li>
			</ul>
			<!-- <h5><span>所有商品</span></h5> -->
			<ul class="view-control">
				<li><i class="fa fa-list-ul" aria-hidden="true"></i>图表视图</li>
				<li class="press"><i class="fa fa-th-large" aria-hidden="true"></i>图标视图</li>
				<!-- <i class="fa fa-list-ul" aria-hidden="true"></i>
				<i class="fa fa-th-large" aria-hidden="true"></i> -->
			</ul>
			<div onclick="createSale()"  class="product-checkout skinbtn"><span>下&nbsp&nbsp单</span></div>
		</div>
	</div>
	<div class="modal fade" id="orderModel" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-dialog" style="width:70%;">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
						&times;
					</button>
					<h4 class="modal-title" id="myModalLabel">
						订单
					</h4>
				</div>
				<div class="modal-body-diy">
					<table id="oderTable" class="table table-striped">
						<thead>
							<tr>
								<th>订单号</th>
								<th>下单时间</th>
								<th>总价</th>
								<th>经手人</th>
								<th>状态</th>
								<th>明细</th>
								<!--<th>订单号</th>
								<th>商品名称</th>
								<th>数量</th>
								<th>规格</th>
								<th>价格</th>-->
							</tr>
						</thead>
						<tbody>
							<tr>
								<td>123123</td>
								<td>2014 9 6</td>
								<td>23</td>
								<td>单独辅</td>
								<td><i class="fa fa-plus-square-o" aria-hidden="true"></i></td>
							</tr>
						</tbody>
					</table>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">关闭
					</button>
				</div>
			</div><!-- /.modal-content -->
		</div><!-- /.modal -->
	</div>
	<div class="modal fade" id="paymentType" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-dialog" style="width:70%;max-height:450px">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
						&times;
					</button>
					<h4 class="modal-title" id="myModalLabel">
						支付方式
					</h4>
				</div>
				<div class="modal-body">
					<div class="payment-header">
						<h3>下单成功，请选择支付方式</h3>
					</div>
					<!--startprint-->
					<div class="printContent">
						<p>***奶茶店</p>
						<p>经手人:<span id="dutyStaff"></span>打印日期:<span id="printDate"></span>队号:<span id="queenNumber"></span></p>
						<table id="printTable" class="table table-striped-">
							<thead>
								<tr>
									<th>品名</th>
									<th>原价</th>
									<th>折扣</th>
									<th>结算单价</th>
									<th>数量</th>
									<th>金额</th>
								</tr>
							</thead>
							<tbody>
								<tr>
									<td>品名</td>
									<td>原价</td>
									<td>折扣</td>
									<td>结算单价</td>
									<td>数量</td>
									<th>金额</td>
								</tr>
							</tbody>
							<tfoot>
								<tr>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
									<td rowspan="3" >合计:<span></span><br>付款:<span></span><br>找零:<span></span></td>
									<th></td>
								</tr>								
							</tfoot>
						</table>
					</div>
					<!--endprint-->
					<div class="payment-footer">
						<!-- <button  class="btn btn-default" >现金</button><input type="number" value="" onchange="cash(this)" id="cash">
						<button  class="btn btn-info" >支付宝</button>
						<button  class="btn btn-success" >微信</button>
						<button  class="btn btn-warning" >银行卡</button> -->
						<label><input onchange="cash(this)" type="radio" name="payment" value="现金">现金</label>
						<label><input type="radio" name="payment" checked value="支付宝">支付宝</label>
						<label><input type="radio" name="payment" value="微信">微信</label>
						<label><input type="radio" name="payment" value="银行卡"/>银行卡</label>
						<button class="btn btn-success" >确认</button>
						<input onchange="takeCash(this)" id="cash" placeholder="金额" type='number' style="display:none;" value="0">
					</div>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">关闭
					</button>
				</div>
			</div><!-- /.modal-content -->
		</div><!-- /.modal -->
	</div>
</body>
</html>
<script type="text/javascript">
//	var product = ""
//	$(document).ready(function(){
//		var height = window.outerHeight
//	  	$("#wrapper").css("height",height+"px")
//	  	productModule.productNum()
//	  	productModule.deleteProduct()
//	  	productModule.addProduct()
//	  	header.exitUser()
//	});
	function imageViewProduct(result){
		$('.product-block-list').html("")
		$('.product-block-list').append("<div class='product-list-control'><ul class=''>	</ul></div>")
		var maxListItem = 12
		var type = result.length
		var listNum = Math.ceil(type/maxListItem)
		for(var j=0;j<listNum;j++){
			$('.product-block-list').prepend("<div class='product-img-list'></div>")
		}
		/* console.log(result[11].spec[0][2]) */
		/* console.log(result) */
		for(var i=0;i<type;i++){
			var wide = Math.ceil(i/maxListItem)-1
			/* console.log(result[i].spec[0][2]+","+i) */
			/* var c = result[i].spec[0][2] */
 			$('.product-img-list').eq(wide).append("<div data-beforeContent='' data-proNo='"+result[i].product.productNo+"' class='product-detail'><ul class='product-name'><li><span>"+result[i].product.productName+"</span></li><li><span>"+result[i].product.producttype.name+"</span></li><li><i class='fa fa-jpy' aria-hidden='true'></i><span>"+result[i].spec[0][2]+"/</span><span>"+result[i].spec[1][2]+"/</span><span>"+result[i].spec[2][2]+"</span></li></ul><div class='thisSize'><ul><li><span>大杯</span></li><li><span>中杯</span></li><li><span>小杯</span></li></ul></div>")
		}
		var _length = $('.product-block-list').children('.product-img-list').length
		if(type>16){
			$('.product-list-control').find("ul").append("<li><span>&laquo;</span></li>")
			for(var i=0;i<_length;i++){
				$('.product-list-control').find("ul").append("<li><span>"+(i+1)+"</span></li>")
			}
			$('.product-list-control').find("li").eq(1).children("span").addClass("pressbtn")
			$('.product-list-control').find("ul").append("<li><span>&raquo;</span></li>")
		}
		else if(type==0){
			$('.product-block-list').append("<h3>暂无产品!</h3>")
		}
		$('.product-img-list').eq(0).show().siblings('.product-img-list').hide()
		$('.product-list-control ul li').not(":first").not(":last").click(function(){
			var _index = $(this).index()
			/* console.log(_index) */
			$('.product-img-list').eq(_index-1).fadeIn().siblings('.product-img-list').hide()
			$(this).children("span").addClass("pressbtn").parent("li").siblings().children().removeClass("pressbtn")
		})
		$('.product-list-control ul li:first').click(function(){
			for(var i =0 ;i<$('.product-img-list').length;i++){
				if(typeof($('.product-img-list').eq(i).attr("style"))=="undefined"){
					$('.product-list-control ul li').eq(i).click()
					break;
				}
			}
		})
		$('.product-list-control ul li:last').click(function(){
			for(var i =0 ;i<$('.product-img-list').length;i++){
				if(typeof($('.product-img-list').eq(i).attr("style"))=="undefined"){
					$('.product-list-control ul li').eq(i+2).click()
					break;
				}
			}
		})
		$('.thisSize li').click(function(){
			var i = 0;
			/* s.replace(/[^0-9]/ig,"") */
			i = $(this).index()
			var name = $(this).parents(".thisSize").siblings('.product-name').find("span").eq(0).text()
			var spec = $(this).text()
			var price = ($(this).parents(".thisSize").siblings('.product-name').find("li").eq(2).find("span").eq(i).text().replace(/[^0-9]/ig,""))
			var proNo = $(this).parents(".product-detail").attr("data-proNo")
			var product = "<div class='product-top-description'><h4>"+name+"</h4><span class='product-middle-spec'>"+spec+"</span><label>温度<select class='tmp'><option>默认</option><option>热</option><option>冷</option></select></label><label>甜度<select class='swt'><option>30%</option><option>50%</option><option>70%</option><option>100%</option></select></label></div><div class='product-down-price'><div class='product-num-choose'><span class='minus' >－</span><span class='product-num-span' ><input class='product-num' value='1' tyep='text'/></span><span class='add'>＋</span></div><div class='product-num-price'><span><i></i>"+price+"</span></div></div><div class='product-right-delete'><i class='fa fa-trash-o' aria-hidden='true'></i></div>"
			$('.product-list').find('ul').append("<li proNo="+proNo+">"+product+"</li>")
			productModule.productNum()
			productModule.TotalProduct()
			productModule.deleteProduct()
			addRedDotsTips(name,"add1",1)
		})
	}
	function addRedDotsTips(name,way,number){
		var array = $(".product-detail").map(function(){
			return $(this).find(".product-name").find("span").eq(0).text()
		})
		for(var i=0;i<array.length;i++){
			if(array[i] == name){
				a = i;
				break;
			}
		}
		var num = $(".product-detail").eq(a).attr("data-beforeContent")
		if(way=="add1"){
			num++
			$(".product-detail").eq(a).attr("data-beforeContent",num).removeClass("b").addClass("b")	
		}
		else if(way=="addany"){
			num = number
			$(".product-detail").eq(a).attr("data-beforeContent",num).removeClass("b").addClass("b")
			if(num==0){
				$(".product-detail").eq(a).removeClass("b")
			}
		}
		/* else if(){
			
		} */
	}
	function minusRedDotsTips(name,way,number){
		var array = $(".product-detail").map(function(){
			return $(this).find(".product-name").find("span").eq(0).text()
		})
		for(var i=0;i<array.length;i++){
			if(array[i] == name){
				a = i;
				break;
			}
		}
		var num = $(".product-detail").eq(a).attr("data-beforeContent")
		if(way=="min1"){
			num--
			$(".product-detail").eq(a).attr("data-beforeContent",num)
			if(num==0){
				$(".product-detail").eq(a).removeClass("b")
			}
		}
		else if(way=="item"){
			number1 = num - number
			$(".product-detail").eq(a).attr("data-beforeContent",number1)
			if(number1==0){
				$(".product-detail").eq(a).removeClass("b")
			}
		}
		else if(way=="all"){
			$(".product-detail").removeClass("b")
		}
	}
	var header = (function(){
		var exitUser = function(){
			var r=confirm("退出登录？?");
			if (r==true)
			{
				window.location.href='logout.action';
			}
			else
			{
				return false;
			}
		}
		var skin = function(){
			var a,b,c;
			a = Math.floor((Math.random()*255)+1);
			b = Math.floor((Math.random()*255)+1);
			c = Math.floor((Math.random()*255)+1);
			var _rgb = "rgb("+a+","+b+","+c+")"
			$('.skin').css("background",_rgb)
		}
		return{
			exitUser:exitUser,
			skin:skin
		}
	})();
	var productModule =(function(){
		var productNum = function(){
			$(".minus").off("click").on("click",function(){
				var name = $(this).parents(".product-down-price").siblings(".product-top-description").find("h4").text()
				var origin = $(this).parent().children().eq(1).find("input").val()
				if(origin>1){
					$(this).parent().children().eq(1).find("input").val(origin-1)
					minusRedDotsTips(name,"min1",1)
				}
				else if(origin==1||origin==""){
					$(this).parent().children().eq(1).find("input").val(1)
				}
				productModule.TotalProduct()
			})
			$(".add").off("click").on("click",function(){
				var origin = $(this).parent().children().eq(1).find("input").val()
				var name = $(this).parents(".product-down-price").siblings(".product-top-description").find("h4").text()
				if(origin<30){
					if(origin==""){
						origin=0
					}
					o = Number(origin)
					$(this).parent().children().eq(1).find("input").val(o+1)
					addRedDotsTips(name,"add1",1)
				}
				else if(origin>=30){
					alert("单种最多下单30杯！")
				}
				productModule.TotalProduct()
			});
//			$(".add").click(function(){
//				var origin = $(this).parent().children().eq(1).find("input").val()
//				if(origin<30){
//					if(origin==""){
//						origin=0
//					}
//					o = Number(origin)
//					$(this).parent().children().eq(1).find("input").val(o+1)
//				}
//				else if(origin>=30){
//					alert("单种最多下单30杯！")
//				}
//				productModule.TotalProduct()
//			})
			$(".product-num").change(function(){
				var name = $(this).parents(".product-down-price").siblings(".product-top-description").find("h4").text()
				var origin = $(this).val()
				addRedDotsTips(name,"addany",origin)
				if(origin<1||isNaN(origin)){
					$(this).val(1)
					addRedDotsTips(name,"addany",1)
					/* addRedDotsTips(name,"add1",1) */
				}
				else if(origin>30){
					alert("单笔只能30杯！")
					$(this).val(30)
					addRedDotsTips(name,"addany",30)
				}
				productModule.TotalProduct()
			})
		};
//		var addProduct = function(){
//			$('.product-detail').click(function(){
////				alert("1")
//				var imgSrc = $(this).find('img').attr("src")
//				var array = $('.product-list').find('li').map(function(index){
//					return $(this).eq(0).find('.product-top-description').text()
//				}).get()
//				var name = $(this).find('span').eq(0).text()
//				if($('.product-list').find('li').length==0||array.indexOf(name)==-1){
//					var price = $(this).find('span').eq(1).text()
//					var product = "<div class='product-left-img'><img src='"+imgSrc+"' alt='"+name+"'></div><div class='product-top-description'><span>"+name+"</span></div><div class='product-middle-spec'><span>222</span><span>多奶少糖</span></div><div class='product-down-price'><div class='product-num-choose'><span class='minus' >－</span><span class='product-num-span' ><input class='product-num' value='1' tyep='text'/></span><span class='add'>＋</span></div><div class='product-num-price'><span><i>¥</i>"+price+"</span></div></div><div class='product-right-delete'><i class='fa fa-trash-o' aria-hidden='true'></i></div>"
//					$('.product-list').find('ul').append("<li>"+product+"</li>")
//				}
//				else{
//					var location = array.indexOf(name)
//					var tmp = Number($('.product-list').find('li').eq(location).find("input").val())
//					if(tmp<30){
//						$('.product-list').find('li').eq(location).find("input").val(tmp+1)
//					}
//					else{
//						alert('单笔最多30杯!!!')
//					}
//				}
//				productModule.productNum()
//				productModule.TotalProduct()
//				productModule.deleteProduct()
//			})
//		}
		var deleteProduct = function(){
			$(".product-right-delete").off("click").on("click",function(){
				$(this).parents("li").animate({
			    	right:'150px',
			    	opacity:'0.8'
//			    	left:'150px',
//			    	opacity:'0'
			    },200).animate({
			    	left:'400px',
			    	opacity:'0'
			    },500,function(){
			    	$(this).remove()
			    	productModule.TotalProduct()
			    })
			    var name = $(this).siblings(".product-top-description").find("h4").text()
			    var v = Number($(this).siblings(".product-down-price").find("input").val())
			    console.log(v)
			    minusRedDotsTips(name,"item",v)
			})
		};
		var clearProduct = function(a){
//			console.log(a)
			var array = $	(".product-right-delete").map(function(){
				return $(this)
			}).get()
			var i = 0
			for(i=0;i<array.length;i++){
				array[i].click()
			}
			minusRedDotsTips(name,"all",0)
		}
		var TotalProduct = function(){
			var box = $('.order-total-foot ul li span')
			var num = Number(0)
			$('.product-num').each(function(i){
			num += Number($(this).val())
			return num
			})
			var sum = Number(0)
			$('.product-num-price span').each(function(i){
				var n = Number($(this).parent().siblings().find("input").val())
				sum = sum + Number($(this).text()*n)
				return sum;
			});
			var oPrice = sum
			box.eq(1).text(oPrice)
			box.eq(0).text(num)
			box.eq(3).text(oPrice.toFixed(2))
			var total = oPrice
			$('.footer-btn li').eq(2).find("i").eq(1).text(total.toFixed(2))
		}
		return {
			productNum:productNum,
			deleteProduct:deleteProduct,
			TotalProduct:TotalProduct,
			clearProduct:clearProduct,
//			addProduct:addProduct	
		}
	})();

</script>